#ifndef CORE_RECTANGLE_H
#define CORE_RECTANGLE_H
#include "Hitable.h"
namespace RayTracer
{
	//========================================
	class XY_Rect : public Hitable
	{
	public:
		XY_Rect() {}
		XY_Rect(float x0_,float x1_,float y0_,float y1_,float k_,std::shared_ptr<Material> mat)
			: x0(x0_), x1(x1_), y0(y0_), y1(y1_), k(k_), matPtr(mat) { }

		bool Hit(const Ray& r, float t_min, float t_max, HitRecord& rec) const;
		bool BoundingBox(AABB& output_box) const;
	public:
		float& X0() { return x0; }
		float& X1() { return x1; }
		float& Y0() { return y0; }
		float& Y1() { return y1; }
		float& K()  { return k; }
	private:
		float x0, x1, y0, y1, k;
		std::shared_ptr<Material> matPtr;
	};


	//========================================
	class XZ_Rect : public Hitable
	{
	public:
		XZ_Rect() {}
		XZ_Rect(float x0_,float x1_, float z0_, float z1_, float k_, std::shared_ptr<Material> mat)
			: x0(x0_), x1(x1_), z0(z0_), z1(z1_), k(k_), matPtr(mat) { }

		bool Hit(const Ray& r, float t_min, float t_max, HitRecord& rec) const;
		bool BoundingBox(AABB& output_box) const;
	public:
		float& X0() { return x0; }
		float& X1() { return x1; }
		float& Z0() { return z0; }
		float& Z1() { return z1; }
		float& K() { return k; }
	private:
		float x0, x1, z0, z1, k;
		std::shared_ptr<Material> matPtr;
	};

	//========================================
	class YZ_Rect : public Hitable
	{
	public:
		YZ_Rect() {}
		YZ_Rect(float y0_,float y1_, float z0_, float z1_, float k_, std::shared_ptr<Material> mat)
			: y0(y0_), y1(y1_), z0(z0_), z1(z1_), k(k_), matPtr(mat) { }

		bool Hit(const Ray& r, float t_min, float t_max, HitRecord& rec) const;
		bool BoundingBox(AABB& output_box) const;
	public:
		float& Y0() { return y0; }
		float& Y1() { return y1; }
		float& Z0() { return z0; }
		float& Z1() { return z1; }
		float& K() { return k; }
	private:
		float y0, y1, z0, z1, k;
		std::shared_ptr<Material> matPtr;
	};
}
#endif // !CORE_PLANE_H

